package com.huawei.appgallery.forum.posts.card;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Environment;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.util.DisplayMetrics;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener;
import android.widget.TextView;
import com.huawei.appgallery.common.media.api.IImagePreviewProtocol;
import com.huawei.appgallery.forum.base.card.ForumCard;
import com.huawei.appgallery.forum.base.card.bean.ImageInfo;
import com.huawei.appgallery.forum.base.card.bean.Post;
import com.huawei.appgallery.forum.base.card.bean.Reply;
import com.huawei.appgallery.forum.cards.widget.ReplyTextView;
import com.huawei.appgallery.forum.cards.widget.UserInfoTextView;
import com.huawei.appgallery.forum.cards.widget.UserInfoTextView.e;
import com.huawei.appgallery.forum.comments.api.ICommentDetailProtocol;
import com.huawei.appgallery.forum.comments.api.ICommentDetailResult;
import com.huawei.appgallery.forum.option.api.IUpdateCommentActivityProtocol;
import com.huawei.appgallery.forum.option.api.IUpdateCommentActivityResult;
import com.huawei.appgallery.forum.posts.view.PostCommentTriangleView;
import com.huawei.appgallery.forum.user.api.IUserHomePageProtocol;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import java.util.ArrayList;
import java.util.List;
import o.azb;
import o.blc;
import o.bqx;
import o.bsd;
import o.bsx;
import o.btb;
import o.btc;
import o.btu;
import o.bwx;
import o.bxc;
import o.bxv;
import o.byg;
import o.byl;
import o.bzd;
import o.bzd.b;
import o.bzd.d;
import o.bzd.f;
import o.bzd.g;
import o.bzd.j;
import o.bzr;
import o.cbh;
import o.cgz;
import o.cil;
import o.cim.a;
import o.epv;
import o.evk;
import o.fho;
import o.fiu;
import o.fjb;
import o.fjc;
import o.fjo;
import o.fjq;
import o.fkd;
import o.fke;
import o.fkg;
import o.fo;
import o.ll;

public class ForumTopicCommentCard extends ForumCard implements e {
    private ImageView ʻ;
    private View ʻॱ;
    private View ʼ;
    private TextView ʽ;
    protected UserInfoTextView ˊ;
    private PostCommentTriangleView ˊॱ;
    private View ˋ;
    private String ˋˋ;
    private View ˋॱ;
    private PopupMenu ˋᐝ;
    private View ˌ;
    private boolean ˍ = false;
    protected TextView ˎ;
    private View ˎˎ;
    private TextView ˎˏ;
    private ImageView ˏ;
    private ForumTopicCommentCardBean ˏˎ;
    private ReplyTextView ˏॱ;
    private ReplyTextView ͺ;
    protected ImageView ॱ;
    private TextView ॱˊ;
    private View ॱˋ;
    private TextView ॱˎ;
    private TextView ॱॱ;
    private View ॱᐝ;
    private TextView ᐝ;
    private View ᐝॱ;

    protected static class c implements fjq<Boolean> {
        private final com.huawei.appgallery.forum.posts.view.PostDetailActivity.c ˏ;

        public c(com.huawei.appgallery.forum.posts.view.PostDetailActivity.c cVar) {
            this.ˏ = cVar;
        }

        public void onComplete(fjo<Boolean> o_fjo_java_lang_Boolean) {
            boolean z;
            if (o_fjo_java_lang_Boolean.ˊ() && ((Boolean) o_fjo_java_lang_Boolean.ॱ()).booleanValue()) {
                z = true;
            } else {
                z = false;
            }
            bqx.ˏ("ForumTopicCommentCard", "check user result:" + z);
            if (this.ˏ != null) {
                this.ˏ.ˎ(z);
            }
        }
    }

    public ForumTopicCommentCardBean ˏॱ() {
        return this.ˏˎ;
    }

    public ForumTopicCommentCard(Context context) {
        super(context);
    }

    public String ˋॱ() {
        return this.ˋˋ;
    }

    public cgz ˏ(View view) {
        ʽ(view);
        this.ˋ = view.findViewById(b.ˌ);
        if (this.ʼॱ instanceof Activity) {
            azb.ˏ(this.ˋ);
        }
        this.ˏ = (ImageView) view.findViewById(b.ˋᐝ);
        this.ˎˏ = (TextView) view.findViewById(b.ˋˋ);
        this.ˊ = (UserInfoTextView) view.findViewById(b.ˎˎ);
        this.ˊ.setFakeView(this.ˎˏ);
        this.ˊ.setUserFakeViewChangeListener(this);
        this.ˊ.setShowModeratorStamp(true);
        this.ˊ.setShowHostStamp(true);
        this.ˊ.setHostPriority(this.ˊ.ˎ() + 1);
        ˎ();
        this.ᐝ = (TextView) view.findViewById(b.ˋˊ);
        this.ॱॱ = (TextView) view.findViewById(b.ॱˊ);
        this.ʽ = (TextView) view.findViewById(b.ˊˊ);
        this.ʼ = view.findViewById(b.ॱˎ);
        this.ʻ = (ImageView) view.findViewById(b.ˏॱ);
        this.ˊॱ = (PostCommentTriangleView) view.findViewById(b.ˊˋ);
        this.ᐝॱ = view.findViewById(b.ᐝॱ);
        this.ॱˊ = (TextView) view.findViewById(b.ʾ);
        this.ˎ = (TextView) view.findViewById(b.ˊॱ);
        this.ॱ = (ImageView) view.findViewById(b.ʼॱ);
        this.ॱˋ = view.findViewById(b.ʽॱ);
        if (this.ʼॱ instanceof Activity) {
            azb.ˏ(this.ॱˋ);
        }
        this.ʻॱ = view.findViewById(b.ˈ);
        this.ˏॱ = (ReplyTextView) view.findViewById(b.ʻॱ);
        this.ͺ = (ReplyTextView) view.findViewById(b.ॱˋ);
        ॱ(this.ˏॱ);
        ॱ(this.ͺ);
        this.ˋॱ = view.findViewById(b.ˊᐝ);
        this.ॱˎ = (TextView) view.findViewById(b.ˉ);
        this.ॱᐝ = view.findViewById(b.ʿ);
        this.ˌ = view.findViewById(b.ˋॱ);
        this.ˎˎ = view.findViewById(b.ᐝ);
        return this;
    }

    private void ॱ(ReplyTextView replyTextView) {
        replyTextView.setShowHostStamp(true);
        replyTextView.setShowModeratorStamp(true);
        replyTextView.setHostPriority(replyTextView.ˊ() + 1);
    }

    public UserInfoTextView ॱˊ() {
        return this.ˊ;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof ForumTopicCommentCardBean) {
            final ForumTopicCommentCardBean forumTopicCommentCardBean = (ForumTopicCommentCardBean) cardBean;
            this.ˏˎ = (ForumTopicCommentCardBean) cardBean;
            this.ˋˋ = forumTopicCommentCardBean.ॱ();
            if (forumTopicCommentCardBean.ˏॱ()) {
                ͺ();
                return;
            }
            this.ˎˎ.setVisibility(8);
            this.ˋ.setVisibility(0);
            this.ॱˋ.setVisibility(0);
            if (forumTopicCommentCardBean.ʼ() == null || forumTopicCommentCardBean.ʽ() == null) {
                bqx.ॱ("ForumTopicCommentCard", "comment or user is null.");
                return;
            }
            bsx.ˋ(this.ʼॱ, this.ˏ, forumTopicCommentCardBean.ʽ().ˎ());
            ॱ(forumTopicCommentCardBean);
            ʻ(forumTopicCommentCardBean);
            ͺ(forumTopicCommentCardBean);
            ॱ(forumTopicCommentCardBean.ʼ().ʻ(), forumTopicCommentCardBean.ᐝ());
            this.ʼ.setOnClickListener(new OnClickListener(this) {
                final /* synthetic */ ForumTopicCommentCard ॱ;

                {
                    this.ॱ = r1;
                }

                public void onClick(View view) {
                    this.ॱ.ˋᐝ.show();
                }
            });
            ʼ(forumTopicCommentCardBean);
            ˊॱ(forumTopicCommentCardBean);
            this.ˊ.post(new Runnable(this) {
                final /* synthetic */ ForumTopicCommentCard ˋ;

                public void run() {
                    this.ˋ.ˊ.setContentWidth(this.ˋ.ˊ.getWidth());
                    this.ˋ.ˊ.setData(forumTopicCommentCardBean.ʽ());
                }
            });
        }
    }

    private void ͺ() {
        this.ˎˎ.setVisibility(0);
        this.ˋ.setVisibility(8);
        this.ॱˋ.setVisibility(8);
        this.ˎˎ.post(new Runnable(this) {
            final /* synthetic */ ForumTopicCommentCard ˎ;

            {
                this.ˎ = r1;
            }

            public void run() {
                if (!this.ˎ.ˍ) {
                    this.ˎ.ˍ = true;
                    int[] iArr = new int[2];
                    this.ˎ.ˎˎ.getLocationInWindow(iArr);
                    int height = iArr[1] + this.ˎ.ˎˎ.getHeight();
                    Rect rect = new Rect();
                    this.ˎ.ˎˎ.getWindowVisibleDisplayFrame(rect);
                    int height2 = ((rect.height() + this.ˎ.ˋ(this.ˎ.ˉ().getContext())) - epv.ˋ(this.ˎ.ˉ().getContext(), 40)) - ((int) this.ˎ.ˉ().getContext().getResources().getDimension(d.ʻ));
                    if (height2 > height) {
                        LayoutParams layoutParams = this.ˎ.ˎˎ.getLayoutParams();
                        layoutParams.height = (height2 - height) + this.ˎ.ˎˎ.getHeight();
                        this.ˎ.ˎˎ.setLayoutParams(layoutParams);
                    }
                }
            }
        });
    }

    private void ॱ(final ForumTopicCommentCardBean forumTopicCommentCardBean) {
        this.ˏ.setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ ForumTopicCommentCard ˊ;

            public void onClick(View view) {
                this.ˊ.ˊ(forumTopicCommentCardBean);
            }
        });
        this.ˎˏ.setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ ForumTopicCommentCard ˏ;

            public void onClick(View view) {
                this.ˏ.ˊ(forumTopicCommentCardBean);
            }
        });
        this.ᐝ.setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ ForumTopicCommentCard ˊ;

            public void onClick(View view) {
                this.ˊ.ˊ(forumTopicCommentCardBean);
            }
        });
    }

    private void ʻ(ForumTopicCommentCardBean forumTopicCommentCardBean) {
        this.ᐝ.setText(btc.ˏ(ˉ().getContext(), forumTopicCommentCardBean.ʼ().ˎ()));
        if (forumTopicCommentCardBean.ʼ().ˊॱ() > 0) {
            this.ॱॱ.setText(ˉ().getContext().getString(j.ॱˎ, new Object[]{Integer.valueOf(forumTopicCommentCardBean.ʼ().ˊॱ())}));
            this.ॱॱ.setVisibility(0);
        } else {
            this.ॱॱ.setVisibility(8);
        }
        if (TextUtils.isEmpty(forumTopicCommentCardBean.ʼ().ॱ())) {
            this.ʽ.setVisibility(8);
            return;
        }
        this.ʽ.setVisibility(0);
        this.ʽ.setText(btu.ॱ(this.ʼॱ, forumTopicCommentCardBean.ʼ().ॱ().replace("[br]", "\n"), btu.ˏ()));
        this.ʽ.setMovementMethod(LinkMovementMethod.getInstance());
    }

    protected void ˊ(ForumTopicCommentCardBean forumTopicCommentCardBean) {
        fjb ˎ = fho.ˏ().ˋ("User").ˎ("UserHomePageActivity");
        IUserHomePageProtocol iUserHomePageProtocol = (IUserHomePageProtocol) ˎ.ˊ();
        iUserHomePageProtocol.setUri("forum|user_detail");
        iUserHomePageProtocol.setUserId(forumTopicCommentCardBean.ʽ().ॱ());
        iUserHomePageProtocol.setType(forumTopicCommentCardBean.ʽ().ˊ());
        iUserHomePageProtocol.setDomainId(forumTopicCommentCardBean.ॱ());
        fiu.ˊ().ˏ(ˉ().getContext(), ˎ);
    }

    private void ʼ(final ForumTopicCommentCardBean forumTopicCommentCardBean) {
        List ॱॱ = forumTopicCommentCardBean.ʼ().ॱॱ();
        if (ॱॱ == null || ॱॱ.isEmpty()) {
            this.ʻ.setVisibility(8);
        } else {
            String ˊ;
            if (TextUtils.isEmpty(((ImageInfo) ॱॱ.get(0)).ˋ())) {
                ˊ = ((ImageInfo) ॱॱ.get(0)).ˊ();
            } else {
                ˊ = ((ImageInfo) ॱॱ.get(0)).ˋ();
            }
            if (!TextUtils.isEmpty(ˊ)) {
                this.ʻ.setVisibility(0);
                int ᐝ = ᐝ();
                bqx.ˏ("ForumTopicCommentCard", "imgview maxWidth:" + ᐝ);
                ˊ(this.ʻ, ᐝ, ˊ, ((ImageInfo) ॱॱ.get(0)).ˎ(), ((ImageInfo) ॱॱ.get(0)).ˏ());
                final ArrayList arrayList = new ArrayList();
                blc o_blc = new blc();
                o_blc.ॱ(((ImageInfo) ॱॱ.get(0)).ˊ());
                o_blc.ॱ(((ImageInfo) ॱॱ.get(0)).ˎ());
                o_blc.ˋ(((ImageInfo) ॱॱ.get(0)).ˏ());
                o_blc.ˋ(((ImageInfo) ॱॱ.get(0)).ˋ());
                arrayList.add(o_blc);
                this.ʻ.setOnClickListener(new OnClickListener(this) {
                    final /* synthetic */ ForumTopicCommentCard ˎ;

                    public void onClick(View view) {
                        fjb ˎ = fho.ˏ().ˋ("Media").ˎ("ImagePreview");
                        IImagePreviewProtocol iImagePreviewProtocol = (IImagePreviewProtocol) ˎ.ˊ();
                        iImagePreviewProtocol.setSavePath(Environment.getExternalStorageDirectory() + "/Pictures/" + this.ˎ.ʼॱ.getString(j.ʻ));
                        iImagePreviewProtocol.setOffset(0);
                        iImagePreviewProtocol.setImageBeans(arrayList);
                        fiu.ˊ().ˏ(this.ˎ.ˉ().getContext(), ˎ);
                    }
                });
                bzr.ˎ(this.ʻ, ˊ);
            }
        }
        ʽ(forumTopicCommentCardBean);
        this.ˋ.setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ ForumTopicCommentCard ˏ;

            public void onClick(View view) {
                this.ˏ.ˊ(forumTopicCommentCardBean, false, false);
            }
        });
        ᐝ(forumTopicCommentCardBean);
    }

    public int ᐝ() {
        return (int) (((float) ((azb.ॱ(ˉ().getContext()) - azb.ˏ(this.ʼॱ)) - azb.ᐝ(this.ʼॱ))) - ˉ().getContext().getResources().getDimension(d.ˎ));
    }

    private void ᐝ(final ForumTopicCommentCardBean forumTopicCommentCardBean) {
        this.ॱˋ.setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ ForumTopicCommentCard ॱ;

            public void onClick(View view) {
                this.ॱ.ˊ(forumTopicCommentCardBean, false, false);
            }
        });
        this.ʽ.setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ ForumTopicCommentCard ॱ;

            public void onClick(View view) {
                this.ॱ.ˊ(forumTopicCommentCardBean, false, false);
            }
        });
        this.ᐝॱ.setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ ForumTopicCommentCard ˊ;

            public void onClick(View view) {
                this.ˊ.ˊ(forumTopicCommentCardBean, true, false);
            }
        });
        this.ˌ.setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ ForumTopicCommentCard ˋ;

            public void onClick(View view) {
                this.ˋ.ˏ(forumTopicCommentCardBean).ˏ(new fke<bxc>(this) {
                    final /* synthetic */ AnonymousClass4 ˏ;

                    {
                        this.ˏ = r1;
                    }

                    public /* synthetic */ void ॱ(Object obj) {
                        ˊ((bxc) obj);
                    }

                    public void ˎ(fkg o_fkg) {
                    }

                    public void ˊ(bxc o_bxc) {
                        if (o_bxc.ˏ() == 9 && o_bxc.ˎ()) {
                            bqx.ˏ("ForumTopicCommentCard", "AUTHENTION_ACCESS is ok");
                            this.ˏ.ˋ.ॱॱ(forumTopicCommentCardBean);
                        } else if (o_bxc.ˏ() == 0 && o_bxc.ˎ()) {
                            bqx.ˏ("ForumTopicCommentCard", "response is ok");
                        } else if (o_bxc.ˏ() == -1 && !o_bxc.ˎ()) {
                            bqx.ˏ("ForumTopicCommentCard", "response is fail");
                            this.ˏ.ˋ.ॱॱ(forumTopicCommentCardBean);
                        }
                    }

                    public void ˊ(Exception exception) {
                    }

                    public void ॱ() {
                    }
                });
            }
        });
    }

    public fkd<bxc> ˏ(ForumTopicCommentCardBean forumTopicCommentCardBean) {
        return ((bwx) fho.ˏ().ˋ("Operation").ॱ(bwx.class)).ˊ(ˉ().getContext(), forumTopicCommentCardBean.ʼ().ॱˊ(), 1, forumTopicCommentCardBean.ʼ().ˏ(), forumTopicCommentCardBean.ᐝ() ? 1 : 0, this.ˋˋ, forumTopicCommentCardBean.ˊ());
    }

    private void ʽ(ForumTopicCommentCardBean forumTopicCommentCardBean) {
        if (forumTopicCommentCardBean.ˊॱ() > 0) {
            this.ॱˊ.setText(String.valueOf(forumTopicCommentCardBean.ˊॱ()));
        } else {
            this.ॱˊ.setText(j.ॱᐝ);
        }
    }

    private void ˊ(ImageView imageView, int i, String str, int i2, int i3) {
        Object obj;
        if (bsx.ˎ(str)) {
            obj = 1;
        } else {
            obj = null;
        }
        float f = 0.5f;
        if (i2 <= 0 || i3 <= 0) {
            i2 = i / 2;
        } else {
            f = ((float) i3) / ((float) i2);
        }
        LayoutParams layoutParams = imageView.getLayoutParams();
        if (obj == null) {
            layoutParams.width = i;
            layoutParams.height = (int) (f * ((float) i));
        } else if (i2 < i) {
            layoutParams.width = i2;
            layoutParams.height = (int) (f * ((float) i2));
        } else {
            layoutParams.width = i;
            layoutParams.height = (int) (f * ((float) i));
        }
        imageView.setLayoutParams(layoutParams);
    }

    private void ॱॱ(ForumTopicCommentCardBean forumTopicCommentCardBean) {
        if (forumTopicCommentCardBean.ᐝ()) {
            forumTopicCommentCardBean.ˎ(0);
            forumTopicCommentCardBean.ʼ().ˋ(forumTopicCommentCardBean.ʼ().ʻ() - 1);
        } else {
            forumTopicCommentCardBean.ˎ(1);
            forumTopicCommentCardBean.ʼ().ˋ(forumTopicCommentCardBean.ʼ().ʻ() + 1);
        }
        ॱ(forumTopicCommentCardBean.ʼ().ʻ(), forumTopicCommentCardBean.ᐝ());
    }

    private void ˊ(ForumTopicCommentCardBean forumTopicCommentCardBean, boolean z, boolean z2) {
        if (!z || ॱ(forumTopicCommentCardBean.ʼ(), false)) {
            ॱ(forumTopicCommentCardBean, z, z2);
        }
    }

    public void ॱ(final ForumTopicCommentCardBean forumTopicCommentCardBean, boolean z, boolean z2) {
        cil.ˋ(this.ʼॱ, new a().ˊ(forumTopicCommentCardBean.ʼ().ͺ()).ˋ());
        fjb ˎ = fho.ˏ().ˋ("Comments").ˎ("comment.detail.activity");
        ICommentDetailProtocol iCommentDetailProtocol = (ICommentDetailProtocol) ˎ.ˊ();
        iCommentDetailProtocol.setUri(forumTopicCommentCardBean.ʼ().ͺ());
        iCommentDetailProtocol.setSourceType(1);
        iCommentDetailProtocol.setNeedComment(z);
        iCommentDetailProtocol.setDomainId(forumTopicCommentCardBean.ॱ());
        iCommentDetailProtocol.setClickReplyView(z2);
        iCommentDetailProtocol.setCommentStatus(forumTopicCommentCardBean.ʼ().ॱˊ());
        fiu.ˊ().ॱ(ˉ().getContext(), ˎ, new fjc<ICommentDetailResult>(this) {
            final /* synthetic */ ForumTopicCommentCard ˎ;

            public /* synthetic */ void ˎ(int i, Object obj) {
                ॱ(i, (ICommentDetailResult) obj);
            }

            public void ॱ(int i, ICommentDetailResult iCommentDetailResult) {
                if (i == -1 && iCommentDetailResult != null) {
                    bqx.ˏ("ForumTopicCommentCard", "startCommentActivity onResult result.isLike:" + iCommentDetailResult.getLike() + ", result.getLikeCount:" + iCommentDetailResult.getLikeCount() + ", result.getReplyCount:" + iCommentDetailResult.getReplyCount());
                    this.ˎ.ˊ(forumTopicCommentCardBean, iCommentDetailResult);
                }
            }
        });
    }

    protected void ˊ(ForumTopicCommentCardBean forumTopicCommentCardBean, ICommentDetailResult iCommentDetailResult) {
        forumTopicCommentCardBean.ʼ().ˋ(iCommentDetailResult.getLikeCount());
        forumTopicCommentCardBean.ˎ(iCommentDetailResult.getLike() ? 1 : 0);
        forumTopicCommentCardBean.ˏ(iCommentDetailResult.getReplyCount());
        ॱ(forumTopicCommentCardBean.ʼ().ʻ(), forumTopicCommentCardBean.ᐝ());
        ʽ(forumTopicCommentCardBean);
        if (this.ˋॱ.getVisibility() == 0) {
            this.ॱˎ.setText(ˉ().getContext().getResources().getQuantityString(g.ˊ, forumTopicCommentCardBean.ˊॱ(), new Object[]{Integer.valueOf(forumTopicCommentCardBean.ˊॱ())}));
        }
    }

    private void ˊॱ(final ForumTopicCommentCardBean forumTopicCommentCardBean) {
        List ͺ = forumTopicCommentCardBean.ͺ();
        if (ͺ == null || ͺ.isEmpty()) {
            this.ॱᐝ.setVisibility(8);
            this.ˊॱ.setVisibility(8);
            return;
        }
        this.ˊॱ.setVisibility(0);
        this.ˊॱ.setColor(fo.ˋ(this.ʼॱ, ʼ()));
        this.ॱᐝ.setVisibility(0);
        this.ॱᐝ.setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ ForumTopicCommentCard ˊ;

            public void onClick(View view) {
                this.ˊ.ˊ(forumTopicCommentCardBean, false, true);
            }
        });
        ˋ(this.ˏॱ, (Reply) ͺ.get(0), forumTopicCommentCardBean);
        if (ͺ.size() > 1) {
            ˋ(this.ͺ, (Reply) ͺ.get(1), forumTopicCommentCardBean);
        } else {
            this.ͺ.setVisibility(8);
        }
        if (forumTopicCommentCardBean.ˊॱ() > 2) {
            this.ˋॱ.setVisibility(0);
            this.ॱˎ.setText(ˉ().getContext().getResources().getQuantityString(g.ˊ, forumTopicCommentCardBean.ˊॱ(), new Object[]{Integer.valueOf(forumTopicCommentCardBean.ˊॱ())}));
            this.ॱˎ.setOnClickListener(new OnClickListener(this) {
                final /* synthetic */ ForumTopicCommentCard ॱ;

                public void onClick(View view) {
                    this.ॱ.ˊ(forumTopicCommentCardBean, false, true);
                }
            });
            this.ʻॱ.setPadding(this.ʻॱ.getPaddingLeft(), this.ʻॱ.getPaddingTop(), this.ʻॱ.getPaddingRight(), 0);
        } else {
            this.ˋॱ.setVisibility(8);
            this.ʻॱ.setPadding(this.ʻॱ.getPaddingLeft(), this.ʻॱ.getPaddingTop(), this.ʻॱ.getPaddingRight(), (int) this.ʼॱ.getResources().getDimension(d.ʻ));
        }
        this.ʻॱ.setOnTouchListener(new OnTouchListener(this) {
            final /* synthetic */ ForumTopicCommentCard ˋ;

            public boolean onTouch(View view, MotionEvent motionEvent) {
                switch (motionEvent.getAction()) {
                    case 0:
                        this.ˋ.ॱˎ();
                        break;
                    case 1:
                        this.ˋ.ॱᐝ();
                        this.ˋ.ˊ(forumTopicCommentCardBean, false, true);
                        break;
                    case 3:
                        this.ˋ.ॱᐝ();
                        break;
                }
                return true;
            }
        });
    }

    private void ॱᐝ() {
        this.ʻॱ.setBackground(fo.ˊ(this.ʼॱ, ʻ()));
        this.ˊॱ.setColor(fo.ˋ(this.ʼॱ, ʼ()));
        this.ˊॱ.invalidate();
    }

    private void ॱˎ() {
        this.ʻॱ.setBackground(fo.ˊ(this.ʼॱ, ॱॱ()));
        this.ˊॱ.setColor(fo.ˋ(this.ʼॱ, ʽ()));
        this.ˊॱ.invalidate();
    }

    private void ͺ(final ForumTopicCommentCardBean forumTopicCommentCardBean) {
        this.ˋᐝ = new PopupMenu(ˉ().getContext(), this.ʼ);
        this.ˋᐝ.getMenuInflater().inflate(f.ˏ, this.ˋᐝ.getMenu());
        if (forumTopicCommentCardBean.ʽ().ʼ()) {
            this.ˋᐝ.getMenu().findItem(b.ॱـ).setVisible(false);
            this.ˋᐝ.getMenu().findItem(b.ˍ).setVisible(true);
            this.ˋᐝ.getMenu().findItem(b.ꜞ).setVisible(true);
        } else {
            this.ˋᐝ.getMenu().findItem(b.ॱـ).setVisible(true);
            this.ˋᐝ.getMenu().findItem(b.ˍ).setVisible(false);
            this.ˋᐝ.getMenu().findItem(b.ꜞ).setVisible(false);
        }
        this.ˋᐝ.setOnMenuItemClickListener(new OnMenuItemClickListener(this) {
            final /* synthetic */ ForumTopicCommentCard ˋ;

            public boolean onMenuItemClick(MenuItem menuItem) {
                boolean z = true;
                int itemId = menuItem.getItemId();
                if (itemId == b.ˍ) {
                    this.ˋ.ˎ(forumTopicCommentCardBean);
                } else if (itemId == b.ॱـ) {
                    this.ˋ.ˋ(forumTopicCommentCardBean);
                } else if (itemId != b.ꜞ) {
                    z = false;
                } else if (bsd.ˏ(forumTopicCommentCardBean.ॱˊ())) {
                    this.ˋ.ˊॱ();
                } else if (this.ˋ.ॱ(forumTopicCommentCardBean.ʼ(), true)) {
                    this.ˋ.ˊ(forumTopicCommentCardBean.ʼ());
                }
                if (z) {
                    this.ˋ.ˋᐝ.dismiss();
                }
                return false;
            }
        });
    }

    protected void ˊॱ() {
        evk.ˏ(this.ʼॱ, j.ˎ, 0).ˋ();
    }

    public void ˎ(final ForumTopicCommentCardBean forumTopicCommentCardBean) {
        ((bwx) fho.ˏ().ˋ("Operation").ॱ(bwx.class)).ˏ(ˉ().getContext(), forumTopicCommentCardBean.ʼ().ˏ(), this.ˋˋ).ˏ(new fjq<Boolean>(this) {
            final /* synthetic */ ForumTopicCommentCard ˏ;

            public void onComplete(fjo<Boolean> o_fjo_java_lang_Boolean) {
                if (o_fjo_java_lang_Boolean.ˊ() && ((Boolean) o_fjo_java_lang_Boolean.ॱ()).booleanValue()) {
                    bqx.ˏ("ForumTopicCommentCard", "deletePost success");
                    Intent intent = new Intent("com.huawei.appgallery.forum.posts.deletecomment");
                    intent.putExtra("comment_id", forumTopicCommentCardBean.ʼ().ˏ());
                    ll.ˏ(this.ˏ.ˉ().getContext()).ˋ(intent);
                }
            }
        });
    }

    public void ˋ(ForumTopicCommentCardBean forumTopicCommentCardBean) {
        if (ॱ(forumTopicCommentCardBean.ʼ(), false)) {
            ((bwx) fho.ˏ().ˋ("Operation").ॱ(bwx.class)).ˎ(ˉ().getContext(), new bxv.d(forumTopicCommentCardBean.ʽ().ˎ(), forumTopicCommentCardBean.ʽ().ˋ(), 1, forumTopicCommentCardBean.ʼ().ˏ()).ˊ(forumTopicCommentCardBean.ʼ().ˊ()).ˎ(forumTopicCommentCardBean.ʼ().ॱ()).ॱ(forumTopicCommentCardBean.ʼ().ॱॱ()).ˏ(forumTopicCommentCardBean.ॱ()).ˎ());
        }
    }

    public void ˊ(final Post post) {
        fjb ˎ = fho.ˏ().ˋ("Option").ˎ("option.update.comment");
        IUpdateCommentActivityProtocol iUpdateCommentActivityProtocol = (IUpdateCommentActivityProtocol) ˎ.ˊ();
        if (this.ˏˎ != null) {
            iUpdateCommentActivityProtocol.setDomainId(this.ˏˎ.ॱ());
        }
        byl o_byl = null;
        List ॱॱ = post.ॱॱ();
        if (!(ॱॱ == null || ॱॱ.isEmpty())) {
            byl o_byl2 = new byl(((ImageInfo) ॱॱ.get(0)).ॱ(), ((ImageInfo) ॱॱ.get(0)).ˊ());
            o_byl2.ˊ(((ImageInfo) ॱॱ.get(0)).ˏ());
            o_byl2.ˎ(((ImageInfo) ॱॱ.get(0)).ˎ());
            o_byl = o_byl2;
        }
        byg o_byg = new byg(post.ˏ(), post.ॱ(), o_byl);
        o_byg.ॱ(post.ˏ());
        iUpdateCommentActivityProtocol.setCommentData(o_byg);
        fiu.ˊ().ॱ(ˉ().getContext(), ˎ, new fjc<IUpdateCommentActivityResult>(this) {
            final /* synthetic */ ForumTopicCommentCard ˋ;

            public /* synthetic */ void ˎ(int i, Object obj) {
                ॱ(i, (IUpdateCommentActivityResult) obj);
            }

            public void ॱ(int i, IUpdateCommentActivityResult iUpdateCommentActivityResult) {
                bqx.ˏ("ForumTopicCommentCard", "modify comment result:" + i);
                if (i == -1 && iUpdateCommentActivityResult != null) {
                    this.ˋ.ॱ(post, iUpdateCommentActivityResult.getUpdateCommentResult());
                }
            }
        });
    }

    public void ॱ(Post post, byg o_byg) {
        if (o_byg == null) {
            bqx.ˊ("ForumTopicCommentCard", "IUpdateCommentActivityResult == null");
            return;
        }
        bqx.ˏ("ForumTopicCommentCard", "modify comment success，tid: " + o_byg.ˋ() + "  pid:" + o_byg.ˏ());
        bzr.ॱ(o_byg, post);
        ll.ˏ(ˉ().getContext()).ˋ(new Intent("com.huawei.appgallery.forum.posts.refreshlist"));
        evk.ˏ(ˉ().getContext().getString(j.ˏ));
    }

    public void ॱ(long j, boolean z) {
        if (j > 0) {
            this.ˎ.setText(String.valueOf(j));
        } else {
            this.ˎ.setText(j.ᐝॱ);
        }
        if (z) {
            this.ॱ.setImageResource(bzd.e.ʽ);
        } else {
            this.ॱ.setImageResource(bzd.e.ʻ);
        }
    }

    private void ˋ(ReplyTextView replyTextView, final Reply reply, final ForumTopicCommentCardBean forumTopicCommentCardBean) {
        final fjb ˎ = fho.ˏ().ˋ("User").ˎ("UserHomePageActivity");
        final IUserHomePageProtocol iUserHomePageProtocol = (IUserHomePageProtocol) ˎ.ˊ();
        iUserHomePageProtocol.setDomainId(forumTopicCommentCardBean.ॱ());
        iUserHomePageProtocol.setUri("forum|user_detail");
        replyTextView.setVisibility(0);
        WindowManager windowManager = (WindowManager) this.ʼॱ.getSystemService("window");
        DisplayMetrics displayMetrics = new DisplayMetrics();
        windowManager.getDefaultDisplay().getMetrics(displayMetrics);
        replyTextView.setMaxWidth((int) ((((float) displayMetrics.widthPixels) - (this.ʼॱ.getResources().getDimension(d.ॱॱ) * 3.0f)) - this.ʼॱ.getResources().getDimension(d.ˎ)));
        replyTextView.setData(reply, new OnClickListener(this) {
            final /* synthetic */ ForumTopicCommentCard ˋ;

            public void onClick(View view) {
                iUserHomePageProtocol.setUserId(reply.ॱ().ॱ());
                iUserHomePageProtocol.setType(reply.ॱ().ˊ());
                fiu.ˊ().ˏ(this.ˋ.ˉ().getContext(), ˎ);
            }
        }, new OnClickListener(this) {
            final /* synthetic */ ForumTopicCommentCard ˏ;

            public void onClick(View view) {
                iUserHomePageProtocol.setUserId(reply.ˎ().ॱ());
                iUserHomePageProtocol.setType(reply.ˎ().ˊ());
                fiu.ˊ().ˏ(this.ˏ.ˉ().getContext(), ˎ);
            }
        }, new OnClickListener(this) {
            final /* synthetic */ ForumTopicCommentCard ˋ;

            public void onClick(View view) {
                this.ˋ.ˊ(forumTopicCommentCardBean, false, true);
            }
        }, new ReplyTextView.b(this) {
            final /* synthetic */ ForumTopicCommentCard ˋ;

            {
                this.ˋ = r1;
            }

            public void ˊ(boolean z) {
                if (z) {
                    this.ˋ.ॱˎ();
                } else {
                    this.ˋ.ॱᐝ();
                }
            }
        });
    }

    public boolean ॱ(final Post post, boolean z) {
        if (!btb.ˊ(ˉ().getContext(), post.ॱˊ(), z)) {
            return false;
        }
        if (!z) {
            return true;
        }
        ˎ(new com.huawei.appgallery.forum.posts.view.PostDetailActivity.c(this) {
            final /* synthetic */ ForumTopicCommentCard ˋ;

            public void ˎ(boolean z) {
                if (z) {
                    this.ˋ.ˊ(post);
                }
            }
        });
        return false;
    }

    protected void ˎ(com.huawei.appgallery.forum.posts.view.PostDetailActivity.c cVar) {
        ((cbh) fho.ˏ().ˋ("User").ॱ(cbh.class)).ˎ(ˉ().getContext(), 15).ˏ(new c(cVar));
    }

    private int ˋ(Context context) {
        int identifier = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
        if (identifier > 0) {
            return context.getResources().getDimensionPixelSize(identifier);
        }
        return 0;
    }

    public void ˊ(int i) {
        this.ˎˏ.setWidth((this.ʼॱ.getResources().getDimensionPixelSize(d.ˏॱ) + (this.ʼॱ.getResources().getDimensionPixelSize(d.ʽ) * 2)) + i);
    }

    public void ˎ() {
    }

    public int ʼ() {
        return bzd.a.ॱ;
    }

    public int ʽ() {
        return bzd.a.ˏ;
    }

    public int ʻ() {
        return bzd.e.ˈ;
    }

    public int ॱॱ() {
        return bzd.e.ʼॱ;
    }
}
